﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace Message_Board.Models
{
    public class Message
    {
        [Display(Name = "留言编号")]
        [Required(ErrorMessage = "必填")]
        public int ID { get; set; }

        [Display(Name = "留言人")]
        public string UserName { get; set; }

        [Display(Name = "留言主题")]
        [Required(ErrorMessage = "必填")]
        [StringLength(20, MinimumLength = 3, ErrorMessage = "必须是[3,20]个字符")]
        public string Subject { get; set; }

        [Display(Name = "留言类型")]
        [Required(ErrorMessage = "必填")]
        [StringLength(20, MinimumLength = 2, ErrorMessage = "必须是[2,20]个字符")]
        public string MessageType { get; set; }


        [Display(Name = "留言时间")]
        public string Time { get; set; }

        [Display(Name = "留言内容")]
        [Required]
        [StringLength(60, MinimumLength = 3, ErrorMessage = "必须是[3,60]个字符")]
        public string Content { get; set; }

        [Display(Name = "留言楼数")]
        public int Number { get; set; }

        [Display(Name = "回复")]
        public string ReplyName { get; set; }

        [Display(Name = "回复楼数")]
        public int ReplyNumber { get; set; }
    }

    public class MessageDBContext : DbContext
    {
        public DbSet<Message> Messages { get; set; }
    }
}